<template>
  <!-- 纵向布局 -->
  <div
    class="layout-vertical"
    :class="{
      fixed: fixedHeader,
      'no-tabs-bar': !showTabs,
    }"
  >
    <vui-side-bar />
    <div v-if="device === 'mobile' && !collapse" class="v-modal" @click="handleFoldSideBar" />
    <div
      class="vui-main"
      :class="{
        'is-collapse-main': collapse,
      }"
    >
      <div
        class="layout-header"
        :class="{
          'fixed-header': fixedHeader,
        }"
      >
        <vui-nav />
        <vui-tabs v-show="showTabs" />
      </div>
      <vui-app-main />
    </div>
  </div>
</template>

<script>
  import { defineComponent } from 'vue'
  import { useStore } from 'vuex'

  export default defineComponent({
    name: 'LayoutVertical',
    props: {
      collapse: {
        type: Boolean,
        default() {
          return false
        },
      },
      fixedHeader: {
        type: Boolean,
        default() {
          return true
        },
      },
      showTabs: {
        type: Boolean,
        default() {
          return true
        },
      },
      device: {
        type: String,
        default() {
          return 'desktop'
        },
      },
    },
    setup() {
      const store = useStore()

      return {
        handleFoldSideBar: () => store.dispatch('settings/foldSideBar'),
      }
    },
  })
</script>

<style lang="scss" scoped>
  .layout-vertical {
    .fixed-header {
      left: $base-left-menu-width;
      width: $base-right-content-width;
    }
  }
</style>
